<template>
  <!-- 归档 - 弹窗 -->
  <a-modal
    :visible="true"
    title="归档"
    width="624px"
    class="archive-model"
    @cancel="dismiss"
    @ok="okBtnClick"
  >
    <template #closeIcon>
      <svg-icon icon-class="icon_search_delete" class-name="icon-search-delete"></svg-icon>
    </template>
    <!-- 标签内容 -->
    <div class="info-content">
      <div class="content-text">
        <span>*</span>
        <span class="text-tips">归档标签</span>
      </div>
      <div class="content-tags">
        <a-radio-group v-model:value="selectedTagValue">
          <a-radio v-for="(item, i) in dataSource" :key="i" :value="item.id" class="tag-item">{{
            item.labelName
          }}</a-radio>
        </a-radio-group>
      </div>
    </div>
  </a-modal>
</template>
<script setup>
import { message } from 'ant-design-vue';
import { defineProps, defineEmits, ref, watch } from 'vue';
const props = defineProps({
  tags: {
    type: Array,
    required: true
  }
});
const selectedTagValue = ref(-1);
const dataSource = ref(props.tags);
watch(
  props,
  (newValue, oldValue) => {
    if (newValue) {
      dataSource.value = newValue.tags;
    }
  },
  { deep: true }
);
const emit = defineEmits(['onModalMakeSure', 'onModalDismiss']);
function okBtnClick() {
  if (selectedTagValue.value === -1) {
    message.warning('请选择标签');

    return;
  }
  emit('onModalMakeSure', selectedTagValue.value);
}
function dismiss() {
  // console.log('dismiss');
  emit('onModalDismiss');
}
</script>
<style lang="less">
.archive-model {
  top: 100px;
  .icon-search-delete {
    margin: 23px auto 0;
    width: 20px;
    height: 20px;
  }
  .ant-modal-content {
    width: 624px;
    padding-bottom: 24px;
    // height: 426px;
    border-radius: 6px;
    .ant-modal-header {
      display: flex;
      align-items: center;
      height: 66px;
      border-radius: 6px;
      border: 0;
      .ant-modal-title {
        font-size: 18px;
        font-family: Source Han Sans CN, Source Han Sans CN-Medium !important;
        font-weight: 500;
        color: rgba(0, 0, 0, 0.8);
      }
      .ant-modal-close {
        height: 66px !important;
      }
    }
    .ant-modal-body {
      padding: 0;
      .info-content {
        margin-left: 24px;
        width: 576px;
        // max-height: 288px;
        // overflow: auto;
        .content-text {
          margin-bottom: 8px;
          font-size: 14px;
          font-family: Source Han Sans CN, Source Han Sans CN-Regular;
          font-weight: 400;
          color: #ff5252;
          line-height: 22px;
          .text-tips {
            font-size: 14px;
            color: rgba(0, 0, 0, 0.6);
          }
        }
        .content-tags {
          max-height: 288px;
          overflow: auto;
          .ant-radio-group {
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;
            overflow-y: scroll;
            padding-top: 8px;
            padding-left: 3px;
            width: 568px;

            // height: 266px;
          }

          .ant-radio-wrapper {
            margin-bottom: 16px;
            display: flex;
            flex-wrap: wrap;
            width: 255px;
            font-size: 14px;
            font-family: Source Han Sans CN, Source Han Sans CN-Regular;
            font-weight: 400;
            color: rgba(0, 0, 0, 0.8);
            line-height: 22px;
          }
        }
        ::-webkit-scrollbar {
          width: 5px;
          height: 80px;
        }
        ::-webkit-scrollbar-thumb {
          border-radius: 10px;
          background-color: #dee0e3 !important;
        }
      }
    }
    .ant-modal-footer {
      padding: 16px 24px 0 24px;
      border: 0;
      .ant-btn {
        margin-left: 16px;
        border-radius: 4px;
        font-size: 14px;
        color: rgba(0, 0, 0, 0.4);
        font-family: Source Han Sans CN, Source Han Sans CN-Regular;
        &:hover {
          color: var(--themecolor);
        }
      }
      .ant-btn-primary {
        color: #fff;
        &:hover {
          color: #fff;
        }
      }
    }
  }
}
</style>
